import 'dart:io';
import 'package:core_package/core_package.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app_unionad/main/protocol_page.dart';

class PrivacyProtocolWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    TextStyle blackTS = TextStyle(
      color: MyColors.color_43_44_48,
      fontSize: 14,
      fontWeight: MyFontWeight.regular,
    );
    TextStyle blueTS = TextStyle(
      color: Color.fromARGB(255, 15, 187, 222),
      fontSize: 14,
      fontWeight: MyFontWeight.regular,
    );
    return Container(
      padding: EdgeInsets.symmetric(
        horizontal: 20,
        vertical: 20,
      ),
      child: Column(
        children: [
          Text(
            '温馨提示',
            style: TextStyle(
              color: MyColors.color_43_44_48,
              fontSize: 18,
              fontWeight: MyFontWeight.bold,
            ),
          ),
          SizedBox(height: 15),
          Text.rich(
            TextSpan(
              children: [
                TextSpan(
                  text: '欢迎来到汼汼生活！\n请您充分阅读和理解',
                  style: blackTS,
                ),
                // TextSpan(
                //   text: '《中国移动认证服务条款》',
                //   style: blueTS,
                // ),
                // TextSpan(
                //   text: '和',
                //   style: blackTS,
                // ),
                TextSpan(
                  recognizer: TapGestureRecognizer()
                    ..onTap = () {
                      //
                      NavigatorUtil.push(context, ProtocolPage.routeName,arguments: 1);
                    },
                  text: '《注册协议》',
                  style: blueTS,
                ),
                TextSpan(
                  text: '及',
                  style: blackTS,
                ),
                TextSpan(
                  text: '《隐私协议》',
                  style: blueTS,
                  recognizer: TapGestureRecognizer()
                    ..onTap = () {
                     NavigatorUtil.push(context, ProtocolPage.routeName,arguments: 0);
                    },
                ),
                TextSpan(
                  text: "以及本提示的全部内容。点击同意按钮即代表您已经同意前述协议全部条款以及以下约定。\n1为了直接联系到我们，我们会应用自动拨打电话\n2为了实名认证我们会申请使用录制音频、修改或删除存储卡上的照片、媒体内容和文件\n3为了信息推送和信息安全，我们会申请系统设备权限手机设备信息、日志信息;\n4我们会努力采取各种安全技术保护您的个人信息，未经同意，我们不会从第三方获取、共享或对外提供您的信息;\n5您还可以访问、更正、删除您的个人信息。",
                  style: blackTS,
                ),
              ],
            ),
            strutStyle: StrutStyle(forceStrutHeight: true, height: 0.58, leading: 1),
          ),
          Expanded(child: SizedBox()),
          buildBottom(context),
        ],
      ),
    );
  }

  Widget buildBottom(BuildContext context) {
    return Row(
      children: [
        GestureDetector(
          behavior: HitTestBehavior.opaque,
          onTap: () {
            // Navigator.pop(context, false);
            exit(0);
          },
          child: Container(
            width: 124,
            height: 40,
            alignment: Alignment.center,
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(20),
              border: Border.all(
                color: MyColors.color_170_170_170,
                width: 1,
              ),
            ),
            child: Text(
              "拒绝",
              style: TextStyle(
                color: MyColors.color_157_157_157,
                fontWeight: MyFontWeight.regular,
                fontSize: 16,
              ),
            ),
          ),
        ),
        SizedBox(width: 8),
        GestureDetector(
          behavior: HitTestBehavior.opaque,
          onTap: () {
            Navigator.pop(context, true);
          },
          child: Container(
            width: 124,
            height: 40,
            alignment: Alignment.center,
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(20),
              gradient: LinearGradient(
                colors: [
                  Color.fromARGB(255, 66, 237, 255),
                  Color.fromARGB(255, 60, 205, 234),
                ],
                begin: Alignment.centerLeft,
                end: Alignment.centerRight,
              ),
            ),
            child: Text(
              "同意",
              style: TextStyle(
                color: Colors.white,
                fontWeight: MyFontWeight.regular,
                fontSize: 16,
              ),
            ),
          ),
        )
      ],
    );
  }
}
